'use strict';
const openapi = require('mp-cloud-openapi')
const uniID = require('uni-id')
const {wxConfigMp} = require('config')
exports.main = async ({action,params,uniIdToken}, context) => {
	const openapiWeixin = openapi.initWeixin(wxConfigMp)
	const {accessToken} = await openapiWeixin.auth.getAccessToken();
	if(action=='subscribeMessage'){
		return await openapiWeixin.subscribeMessage.send({
			accessToken,
			"touser": params.openid,
			"page":params.page,
			"template_id": params.template_id,
			"data": params.subscribeData
		})
	}else{
		return null
	}
	
};